require(["jquery",'public','swiper'],function($,public,swiper) {
	var id = public.getUrlParam('id');
    //public.headertitle('信息详情');
    public.footer(1);
    public.allocator();

    function getData(id){
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {id:id,type:1},
            async: false,
            url: MODULE+'Goods/goods_info',           
        }).success(function (res) {
            console.log(res);
            if(!res.data)  {
                return false;
            }
            var _swiper = '';
            var intor = '';
            res.data_picture.forEach(function(i){
                if(i.album_type == 1){
                    _swiper += '<div class="swiper-slide">'
                            +       '<div class="swiper-slide-img" style="background-image: url('+PUBLIC+i.album_path+')" data-src="'+i.album_path+'"></div>'
                            +   '</div>';
                }else{
                    intor += '<img src="'+PUBLIC+i.album_path+'" alt="'+i.album_path+'">'
                }
            });
            $('.swiper-wrapper').append(_swiper);
            $('.information_title').html(res.data.goods_name);
            $('.information_price').html('￥'+res.data.goods_price);
            $('.information_intor').html(res.data.goods_main);
            $('.information_intor').append(intor);
        }).fail(function (jqXHR, textStatus, errorThrown) {});
    }

    getData(id);

    var mySwiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        centeredSlides: true,
        autoplay: 2000,
        loop: true, //无缝循环播放
        autoHeight: true,
        //autoplayDisableOnInteraction: false //用户操作后停止轮播
    });

    //页面加载完毕
    public.loaded();
})